﻿/*
 * Created by SharpDevelop.
 * User: 김효순
 * Date: 2012-08-28
 * Time: 오후 1:33
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Runtime.InteropServices;

namespace 메모리
{
	class Program
	{
		[DllImport("kernel32.dll")]
		private extern static void GlobalMemoryStatus(ref MEMORYSTATUS lpBuffer);
		
		struct MEMORYSTATUS{
	        public int dwLength;
	        public int dwMemoryLoad;
	        public int dwTotalPhys;
	        public int dwAvailPhys;
	        public uint dwTotalPageFile;
	        public uint dwAvailPageFile;
	        public int dwTotalVirtual;
	        public int dwAvailVirtual;
		}
		
		public static void Main(string[] args)
		{
			MEMORYSTATUS memst = default(MEMORYSTATUS);
			
			GlobalMemoryStatus(ref memst);
			
			Console.WriteLine("dwLength: " + memst.dwLength.ToString());
			Console.WriteLine("dwMemoryLoad: " + memst.dwMemoryLoad.ToString());
			Console.WriteLine("dwTotalPhys: " + memst.dwTotalPhys.ToString());
			Console.WriteLine("dwAvailPhys: " + memst.dwAvailPhys.ToString());
			Console.WriteLine("dwTotalPageFile: " + memst.dwTotalPageFile.ToString());
			Console.WriteLine("dwAvailPageFile: " + memst.dwAvailPageFile.ToString());
			Console.WriteLine("dwTotalVirtual: " + memst.dwTotalVirtual.ToString());
			Console.WriteLine("dwAvailVirtual: " + memst.dwAvailVirtual.ToString());
			
			// TODO: Implement Functionality Here
			
			Console.Write("Press any key to continue . . . ");
			Console.ReadKey(true);
		}
	}
}